package com.hanlin.route;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 描述：路由模型的消费者
 *
 * @author:hl.yuan
 * @date:2021-03-15
 */
@Component
public class RouteCustomer {


    @RabbitListener(bindings = @QueueBinding(
            value = @Queue,
            key = {"error"},
            exchange = @Exchange(name = "hlyuan_route", type = "direct")
    ))
    public void receiver1(String message) {
        System.out.println("路由模型消费者1" + message);
    }

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue,
            key = {"info","error"},
            exchange = @Exchange(name = "hlyuan_route", type = "direct")
    ))
    public void receiver2(String message) {
        System.out.println("路由模型消费者2" + message);
    }


}
